home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / jtxt.zip / HOOKS.TXT < prev    next >
Text File  |  1991-11-26  |  47KB  |  1,513 lines

  1.  
  2.  
  3.  
  4.  
  5.          Hooks and Forks and the Teaching of Elementary Arithmetic
  6.  
  7.                             Donald B. McIntyre
  8.                           Luachmhor, Church Road
  9.                          Kinfauns, Perth PH2  7LD
  10.                               Scotland - U.K.
  11.                           Telephone:  0738-86-726
  12.  
  13.     Introduction:
  14.  
  15.     After teaching APL to colleagues and students for many years
  16.     [1,2,3], in retirement I am discovering the age-levels at which
  17.     various mathematical concepts can be usefully introduced to
  18.     children with the aid of the executable notation J.   Teachers at
  19.     Edradour School, Pitlochry, are helping me look at the possible use
  20.     of J [4-8] to help children learn arithmetic.   Although lacking
  21.     Zdenek Jizba's experience in the elementary classroom [9], I hope
  22.     the examples given here will encourage teachers to investigate J
  23.     with their pupils.   The underlying notation and syntax of the
  24.     language are explained for the teacher, who must decide how much to
  25.     disclose to particular pupils.
  26.  
  27.     Algebra passed through three stages:  rhetorical, syncopated, and
  28.     symbolic.   At first words were used, without other symbols.   The
  29.     words were then abbreviated, and eventually the abbreviations
  30.     became so contracted that the origin of the symbols was forgotten.
  31.     New symbols were devised for operations hitherto unknown or not
  32.     formalised [10-12].   J provides a large number of symbols, but the
  33.     teacher (or user) can name these, thus reverting to the rhetorical
  34.     (or perhaps syncopated) stage.   This may at times be a convenience
  35.     for any user;  in particular a teacher may find that children are
  36.     at first more comfortable with words than symbols.
  37.  
  38.     As we grow we seem destined to recapitulate the intellectual
  39.     history of our race.   Pupils should nevertheless be encouraged to
  40.     use symbols as early as possible.   Dantzig put it well:  "Greek
  41.     thought was essentially non-algebraic, because it was so concrete.
  42.     The abstract operations of algebra, which deal with objects that
  43.     have purposely been stripped of their physical content, could not
  44.     occur to minds which were so intensely interested in the objects
  45.     themselves.   The symbol is not a mere formality;  it is the very
  46.     essence of algebra.   Without the symbol the object is a human
  47.  
  48.  
  49.  
  50.  
  51.  
  52.                                     -1-
  53.  
  54.  
  55.  
  56.  
  57.     perception and reflects all the phases under which the human senses
  58.     grasp it;   replaced by a symbol the object becomes a complete
  59.     abstraction, a mere operand subject to certain indicated
  60.     operations.  ... The symbol has a meaning which transcends the
  61.     object symbolised;  that is why it is not a mere formality.   It is
  62.     the power of transformation that lifts algebra above the level of a
  63.     convenient shorthand." [11, p.80, 87.  Italics in original].
  64.  
  65.     The J dialect:
  66.  
  67.     Mathematics is a language [11-14].   Indeed Hogben, in a book of
  68.     great popularity and influence, included a chapter on the grammar
  69.     of mathematical language [13], distinguishing the verbs (functions)
  70.     and nouns (data) of mathematical sentences.   Hui and Iverson et al
  71.     have gone further, recognising and implementing adverbs (monadic
  72.     operators) and conjunctions (dyadic operators) [15];  Bernecky and
  73.     Hui have shown the power of gerunds (function arrays) for parallel
  74.     processing [16];  and Iverson and McDonnell added phrasal forms and
  75.     pronouns [17].   J uses pro-verbs, and similar names assigned to
  76.     adverbs and conjunctions [4].
  77.  
  78.     J is a powerful dialect of APL available as Shareware implemented
  79.     for a large number of computers [18].   Its roots are in Iverson
  80.     notation [19] and in APL's method of Direct Definition of functions
  81.     [20, 21, 12].   The spelling adopted uses ASCII characters, either
  82.     alone or immediately followed by a period (.) or colon (:).   Thus
  83.     + is plus, +. is  or, and +: is double; % is divide, %. is matrix
  84.     divide, and %: is square root.   As in all dialects of APL, both
  85.     monadic and dyadic meanings are recognised.    Assignment is
  86.     written =. and read "is".
  87.     %%%
  88.     When an expression is executed the result is produced and can be
  89.     assigned to a variable.   If no assignment is made the result is
  90.     displayed.   In the examples below expressions for execution are
  91.     shown after three spaces at the beginning of the line and the
  92.     results are shown on the next line, beginning in the first column
  93.     of the line.   If the expression is a verb or a pro-verb (the name
  94.     of a verb), then the definition of the verb is shown in boxes (see
  95.     examples later in the article).
  96.     %%%
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.                                     -2-
  107.  
  108.  
  109.  
  110.  
  111.     Names
  112.  
  113.     Nouns, verbs, adverbs, conjunctions, and gerunds can all be
  114.     assigned names.   If the name plus is easier to remember than the
  115.     symbol +, simply assign and use the name.   Names used instead of
  116.     nouns are pronouns;  pro-verbs stand for verbs in a similar way;
  117.     and other parts of speech can be named also.   %%%Here I define
  118.     some names for use in the rest of this article.   The rows of the
  119.     table are the defining expressions in J and can be entered like
  120.     this on a computer running J.   In J the comment symbol is NB. and
  121.     anything after that on a line is ignored.   Definitions given here
  122.     are informal;  see the Dictionary for details [4].
  123.  
  124.     Pro-verbs (or verbs, for short):
  125.  
  126.           add=. +         NB.   synonyms can be helpful.  See plus
  127.           behead=. }.     NB.   drop first item
  128.           copy=. #        NB.   x # y  is x copies of y.  Compression
  129.           divided_by=. %  NB.   12%3   is   4
  130.           double=. +:     NB.   +: 5   is   10
  131.           floor=. <.      NB.   <. x  drop any fractional part of x
  132.           format=. ":     NB.   width and precision of output
  133.           halve=. -:      NB.   -: 10   is   5
  134.           head=. {.       NB.   take the first item
  135.           increm=. >:     NB.   increm is short for increment.  Add 1
  136.           laminate=. ,:   NB.   join two lists to make a table
  137.           larger_of=. >.  NB.   x >. y   choose the larger value
  138.           left=. [        NB.   return the left argument. Formerly }:
  139.           lesser_of=. <.  NB.   x <. y   choose the smaller value
  140.           less_or_equal=. <:    NB.   1 2 3 <: 2   is  1 1 0
  141.           magnitude=. |   NB.   |y is absolute value of y
  142.           match=. -:      NB.   arguments identical
  143.           minus=. -       NB.   4-6  is  _2
  144.           not=. -.        NB.   converts 0 to 1 and 1 to 0
  145.           off=. 0!:55     NB.   Return to DOS with:   off 0
  146.           one_minus=. -.  NB.   1 - y.   This extends the boolean not
  147.           plus=. +        NB.   synonyms can be helpful.   See add
  148.           power=. ^       NB.   3^2  is  9
  149.           reciprocal=. %  NB.   %2  is  0.5
  150.           residue=. |     NB.   x|y is remainder on dividing x into y
  151.           reverse=. |.    NB.   change a list abcde into edcba
  152.           right=. ]       NB.   return the right argument. Formerly {:
  153.           script=. 0!:2@<:(<@[ 0!:2 <@]) NB.  Read/Write script files
  154.                           NB.   'output.fil' script 'input.fil' OR
  155.  
  156.  
  157.  
  158.  
  159.  
  160.                                     -3-
  161.  
  162.  
  163.  
  164.  
  165.                           NB.   'output.fil' script ''  OR
  166.                           NB.   script 'input.fil'
  167.           show=. ]        NB.   return the right argument
  168.           shape=. $       NB.   length of a list or number of rows
  169.                           NB.     and columns of a table.
  170.           signum=. *      NB.   * _5 0 7    is   _1 0 1
  171.           tally=. #       NB.   number of items.  First item of shape
  172.           times=. *       NB.   3*4  is  12
  173.           times_pi=. o.   NB.   Multiply by pi.   o.1  is  pi
  174.           transpose=. |:  NB.   turn a table (or flat) on its side
  175.           tree=. 5!:4 @ < NB.   display structure of a defined verb;
  176.                           NB.     tree 'mean'
  177.           wholes=. i.     NB.   list integers, starting with 0
  178.                           NB.     i. 10
  179.  
  180.     Pro-adverbs (or adverbs, for short):
  181.  
  182.           cross=. ~    NB.  switch or interchange arguments
  183.           fix=. f.     NB.  fix a verb: "compile" it into J symbols
  184.           insert=. /   NB.  insert verb between items
  185.           scan=. \     NB.  apply verb to successively longer subsets
  186.  
  187.     Pro-conjunctions (or conjunctions, for short):
  188.  
  189.           atop=. after=. @   NB.  create a verb by bonding two verbs
  190.           rank=. "           NB   explained in context
  191.           with=. &           NB.  bond a noun to a verb
  192.           %%%
  193.     This use of with for bonding a noun to a verb is sometimes called
  194.     Currying, after the mathematician Haskell B. Curry [15].
  195.  
  196.     Note that (plus insert) is a derived verb, just as run quickly is a
  197.     new verb created from an old one modified by an adverb.   Also
  198.     (plus insert scan) is yet another verb, derived from the first by
  199.     two adverbs, as in run very quickly.
  200.  
  201.     Conjunctions bond nouns or verbs together to form new verbs as in
  202.     divide by 4, or run and hide.   Thus:
  203.           quarter=. % with 4
  204.     and
  205.            >: @ i.
  206.     is a new verb that generates wholes (integers) starting with 1
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.                                     -4-
  215.  
  216.  
  217.  
  218.  
  219.     Plus, Times, Power:
  220.  
  221.     To add up a list of numbers, insert the verb plus between each
  222.     item:
  223.           1 plus 1 plus 1 plus 1 plus 1
  224.     5
  225.     The operation is written concisely by defining the new verb total,
  226.     and using copy to repeat an item:
  227.           total=. plus insert
  228.           total 5 copy 1
  229.     5
  230.     Obtain partial totals by using scan:
  231.           total scan 10 copy 1
  232.     1 2 3 4 5 6 7 8 9 10
  233.  
  234.     The sum of six twos is:
  235.           2 plus 2 plus 2 plus 2 plus 2 plus 2
  236.     12
  237.           total 6 copy 2
  238.     12
  239.     Multiplication was, of course, invented to do this conveniently:
  240.           6 times 2
  241.     12
  242.  
  243.     Similarly:
  244.           2 times 2 times 2 times 2 times 2 times 2
  245.     64
  246.           times insert 6 copy 2
  247.     64
  248.  
  249.     Exponentiation (raising a number to a power) was invented to make
  250.     this easier:
  251.           2 power 6
  252.     64
  253.     The order of the arguments makes a difference (6 copies of 2 is not
  254.     the same as 2 copies of 6); i.e. power is not commutative:
  255.           times insert 2 copy 6
  256.     36
  257.           6 power 2
  258.     36
  259.     The adverb cross interchanges the arguments:
  260.           2 copy cross 6
  261.     2 2 2 2 2 2
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                                     -5-
  269.  
  270.  
  271.  
  272.  
  273.           2 power~ 6
  274.     36
  275.  
  276.     Sum of a list:
  277.  
  278.        show i=. increm wholes 10
  279.     1 2 3 4 5 6 7 8 9 10
  280.        total increm wholes 10
  281.     55
  282.     This total can be obtained (as young Gauss knew) by halving the
  283.     product of the last number and the last number plus 1 [9]:
  284.        i plus reverse i
  285.     11 11 11 11 11 11 11 11 11 11
  286.        halve 10 times 11
  287.     55
  288.  
  289.        total increm wholes 100
  290.     5050
  291.  
  292.     Noting that:
  293.        1 2 3 + 100 99 98
  294.     101 101 101
  295.  
  296.        halve 100 times increm 100
  297.     5050
  298.  
  299.     And
  300.        total increm wholes 1000
  301.     500500
  302.        halve 1000 times increm 1000
  303.     500500
  304.  
  305.  
  306.     Hooks [4, 17]:
  307.  
  308.     The expressions i plus reverse i and  y times increm y are examples
  309.     of a commonly encountered construction.    Two verbs (call them g
  310.     and h) are applied to the data (call it y) in a special way;
  311.     namely, the result of applying h to y becomes the right argument of
  312.     g, and y  appears again as the left argument of g.   The syntax of
  313.     J enables this to be written concisely as:
  314.  
  315.            (g h) y     instead of     y g (h y)
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.                                     -6-
  323.  
  324.  
  325.  
  326.  
  327.     This construction is called a hook.   Note that g, with arguments
  328.     both to the left and right, is dyadic, whereas h, with an argument
  329.     on the right only, is monadic.   The resulting hook is in this case
  330.     monadic (the argument appears only once).   Thus, instead of
  331.     writing:
  332.           i plus reverse i
  333.     11 11 11 11 11 11 11 11 11 11
  334.     write:
  335.           (plus reverse) i
  336.     11 11 11 11 11 11 11 11 11 11
  337.     Similarly:
  338.           halve 100 times increm 100
  339.     5050
  340.           halve (times increm) 100
  341.     5050
  342.     %%%
  343.     The Sum of the Positive Whole Numbers from 1 to n is given by the
  344.     defined verb spwn:
  345.  
  346.        spwn=. halve after (times increm)
  347.        spwn 1000
  348.     500500
  349.     %%%
  350.     Parentheses are needed to get the correct hook, because a
  351.     conjunction (after) seizes the item immediately to its right as its
  352.     right argument.
  353.  
  354.     Dyadic hooks are also common.   They occur when x is modified by
  355.     some function of y.   The syntax is:
  356.  
  357.                x (g h) y    instead of    x g (h y)
  358.  
  359.     Here is an example.   How many steps are there if starting at _2 we
  360.     go to 5? [22]   Not counting the _2 we start at, there are 7 steps:
  361.           # _1 0 1 2 3 4 5
  362.     7
  363.     This number is the magnitude of the difference between _2 and 5:
  364.           (magnitude atop (minus insert)) _2 5
  365.     7
  366.     Or using J symbols:
  367.           n=. | @ (-/)
  368.           n _2 5
  369.     7
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.                                     -7-
  377.  
  378.  
  379.  
  380.  
  381.     If we proceed in steps other than unit steps, we must divide by the
  382.     step size.   The required verb is a hook combining the two verbs
  383.     into and n.   Name it h:
  384.           into=. %~
  385.           nsteps=. into n
  386.     Then for half steps, we have:
  387.           0.5 nsteps _2 5
  388.     14
  389.  
  390.     Display nsteps to see that it consists of two adjacent verbs;  i.e.
  391.     a hook.
  392.           nsteps
  393.     ┌────┬─┐
  394.     │into│n│
  395.     └────┴─┘
  396.     %%%Fix nsteps, so that subsequent changes to its components (into
  397.     and n), will not affect it.
  398.           nsteps=. nsteps fix
  399.  
  400.           nsteps
  401.     ┌─────┬───────────┐
  402.     │┌─┬─┐│┌─┬─┬─────┐│
  403.     ││%│~│││|│@│┌─┬─┐││
  404.     │└─┴─┘││ │ ││-│/│││
  405.     │     ││ │ │└─┴─┘││
  406.     │     │└─┴─┴─────┘│
  407.     └─────┴───────────┘
  408.  
  409.     (( %~ )(| @ ( -/ )))
  410.  
  411.     This is a display of the definition of nsteps.   It shows how the
  412.     expression will be parsed.   There are two outer boxes, and hence
  413.     this a hook.   Contiguous boxes show that the symbols in them are
  414.     to be grouped together.   We can immediately translate the display
  415.     into the fully parenthesised form written immediately below it.
  416.     There is no harm in using the fully parenthesised form, but
  417.     experimentation will show whether parentheses can be omitted with
  418.     impunity.   In this case the parentheses around -/ are needed to
  419.     prevent the conjunction atop (@) from taking the - instead of (-/)
  420.     as its right argument.    Adverbs are monadic, taking the item to
  421.     the left as the argument.   Thus cross (~) modifies the verb
  422.     divided_by (%) to its left and no parentheses are needed to ensure
  423.     this.   So nsteps can be written with a single set of parentheses.
  424.     No spaces are needed, but I have used one to draw attention to the
  425.     two groups of symbols that make the hook.   As we shall see, three
  426.     groups make a fork.
  427.  
  428.  
  429.  
  430.                                     -8-
  431.  
  432.  
  433.  
  434.  
  435.     %%%
  436.           nsteps=. %~ |@(-/)
  437.           0.5 nsteps _2 5
  438.     14
  439.  
  440.     Two hooks are used in the scaling (or normalising) of a list of
  441.     numbers to make the range from 0 to 1.   Such scaling is often
  442.     needed when preparing graphical display.
  443.  
  444.     Let list be the name of the list of numbers nine, three, four,
  445.     negative 2, ..., seven:
  446.           list=. 9 3 4 _2 12 1 _4 15 7
  447.  
  448.     The smallest value will be 0 if we subtract the smallest value.
  449.     This should be quickly recognised as a monadic hook:
  450.           list - <./list
  451.     13 7 8 2 16 5 0 19 11
  452.           (- <./) list
  453.     13 7 8 2 16 5 0 19 11
  454.           q=. minus lesser_of insert
  455.           q=. - <./
  456.           q list
  457.     13 7 8 2 16 5 0 19 11
  458.  
  459.     Similarly:
  460.  
  461.     The largest number will be 1 if we divide list by the largest
  462.     value.   This is another monadic hook.
  463.           p=. % >./
  464.  
  465.     scale is the composite verb in which p is applied to the result of
  466.     q;  i.e.  p is atop q
  467.           scale=. p@q
  468.           0.3 format scale list
  469.     0.684 0.368 0.421 0.105 0.842 0.263 0.000 1.000 0.579
  470.  
  471.     %%%
  472.     Forks [4, 17]:
  473.  
  474.     A fork is a succession, or train, of three verbs.   The meaning
  475.     assigned is this:
  476.             (f g h) y    is    (f y) g (h y)           Monadic
  477.           x (f g h) y    is   (x f ) g (x h y)         Dyadic
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.                                     -9-
  485.  
  486.  
  487.  
  488.  
  489.     The mean is an example of a monadic fork.   Compute it by dividing
  490.     the total [of the list] by the tally [the number of items in the
  491.     list]:%%%
  492.           y=. 1 2 3 4
  493.           (total y) divided_by (tally y)
  494.     2.5
  495.     Display mean in various ways:
  496.  
  497.           mean=. total divided_by tally
  498.  
  499.           mean
  500.     ┌─────┬──────────┬─────┐
  501.     │total│divided_by│tally│
  502.     └─────┴──────────┴─────┘
  503.     %%%
  504.     The string of three boxes shows that mean is a fork.   The same
  505.     information is given by another kind of display, called a parse
  506.     tree.
  507.  
  508.           tree 'mean'
  509.              ┌─ total
  510.     ─ mean ──┼─ divided_by
  511.              └─ tally
  512.  
  513.     Fix the verb, "compiling" it into primitive J symbols.
  514.  
  515.           mean=. mean fix%%%
  516.           mean
  517.     ┌─────┬─┬─┐
  518.     │┌─┬─┐│%│#│
  519.     ││+│/││ │ │
  520.     │└─┴─┘│ │ │
  521.     └─────┴─┴─┘
  522.  
  523.           tree 'mean'
  524.              ┌─ / ─── +
  525.     ─ mean ──┼─ %
  526.              └─ #
  527.  
  528.           mean 1 2 3 4
  529.     2.5
  530.  
  531.     mean is a monadic fork because it takes only a right argument.
  532.     The syntax is:
  533.  
  534.  
  535.  
  536.  
  537.  
  538.                                    -10-
  539.  
  540.  
  541.  
  542.  
  543.                 (f g h) y   is the same as    (f y) g (h y)
  544.  
  545.     The arithmetic progression vector (apv) given below is an example
  546.     of a dyadic fork.   This is its syntax:
  547.               x (f g h) y   is the same as    (x f y) g (x h y)
  548.  
  549.     An example of a fork including a hook as one prong is the verb
  550.     clean, which sets to zero small values resulting from round-off
  551.     errors.   For data take:
  552.           show y=. 1 10 100 1000 10000 into 1.2345
  553.     1.2345 0.12345 0.012345 0.0012345 0.00012345
  554.  
  555.     Let the right argument y be the data to be cleaned, and let
  556.     tolerance be the left argument x;  then the result is y times the
  557.     truth or falsity (1 or 0) of the proposition that the tolerance is
  558.     less-than-or-equal to the magnitude of y:
  559.            y * (x proposition y)
  560.  
  561.     The proposition is a dyadic hook:
  562.            0.01 (less_or_equal magnitude) y
  563.     1 1 1 0 0
  564.            0.01 <: (| y)
  565.     1 1 1 0 0
  566.  
  567.     times is, of course, the central term of the fork:
  568.  
  569.     The verb clean is therefore:
  570.           clean=. right times (less_or_equal magnitude)
  571.  
  572.           clean
  573.     ┌─────┬─────┬─────────────────────────┐
  574.     │right│times│┌─────────────┬─────────┐│
  575.     │     │     ││less_or_equal│magnitude││
  576.     │     │     │└─────────────┴─────────┘│
  577.     └─────┴─────┴─────────────────────────┘
  578.  
  579.           tree 'clean'
  580.  
  581.               ┌─ right
  582.               ├─ times
  583.     ─ clean ──┤        ┌─ less_or_equal
  584.               └────────┴─ magnitude
  585.  
  586.     %%%
  587.  
  588.  
  589.  
  590.  
  591.  
  592.                                    -11-
  593.  
  594.  
  595.  
  596.  
  597.           x=. 0.01
  598.           y=. 1 10 100 1000 10000 into 1.2345
  599.  
  600.           x clean y
  601.     1.2345 0.12345 0.012345 0 0
  602.           x clean -y
  603.     _1.2345 _0.12345 _0.012345 0 0
  604.  
  605.     If we left off the parentheses then less_or_equal would be the
  606.     central term of a fork, which along with right would make a hook.
  607.           f=. right times less_or_equal magnitude
  608.           f
  609.     ┌─────┬────────────────────────────────┐
  610.     │right│┌─────┬─────────────┬──────────┐│
  611.     │     ││times│less_or_equal│magnitude ││
  612.     │     │└─────┴─────────────┴──────────┘│
  613.     └─────┴────────────────────────────────┘
  614.           f=. f fix
  615.           f
  616.     ┌─┬────────┐
  617.     │]│┌─┬──┬─┐│
  618.     │ ││*│<:│|││
  619.     │ │└─┴──┴─┘│
  620.     └─┴────────┘
  621.  
  622.     This would be quite wrong!   Consider why this is so.   A dyadic
  623.     hook like this can be expanded:
  624.  
  625.           x (g h) y     expands to    x g (h y)
  626.     In our case:
  627.           g=. ]
  628.           h=. *<:|
  629.  
  630.           x (g h) y
  631.     1 0 0 0 0
  632.           x g (h y)
  633.     1 0 0 0 0
  634.  
  635.     Because g is the dyadic verb right it returns its right argument;
  636.     so x can make no contribution to the result, which must depend
  637.     solely on the monadic function h applied to y.
  638.  
  639.           h y
  640.     1 0 0 0 0
  641.  
  642.  
  643.  
  644.  
  645.  
  646.                                    -12-
  647.  
  648.  
  649.  
  650.  
  651.     Defining the following pro-verbs:
  652.           p=.*
  653.           q=. <:
  654.           r=. |
  655.     Expand the fork h:
  656.           (p q r) y
  657.     1 0 0 0 0
  658.           (p y) q (r y)
  659.     1 0 0 0 0
  660.     But
  661.           r y
  662.     1.2345 0.12345 0.012345 0.0012345 0.00012345
  663.     And
  664.           p y
  665.     1 1 1 1 1
  666.           (* y) <: (|y)
  667.     1 0 0 0 0
  668.     The monadic times (*) is called the signum.   The result is 1, 0,
  669.     or _1 depending upon whether the argument is positive, zero, or
  670.     negative.   Hence with this definition of f
  671.  
  672.           f=. right times less_or_equal magnitude
  673.  
  674.     the left argument is ignored and the result is 1 if the signum of y
  675.     is less than or equal to the absolute value of y.   This is true
  676.     unless y is a positive number lying between 0 and 1.   This might
  677.     be a useful function in another situation, but it is not what we
  678.     want for clean!
  679.  
  680.     Iverson's utility verbs by and over provide a convenient way to
  681.     illustrate the result.   See the Appendix for an explanation.
  682.  
  683.        x=. 9 0.5 0 _0.5 _9
  684.        y=. _9 _1.5 _1 _0.5 0 1e_3 0.3 0.4 0.999 1 2 10 100
  685.  
  686.        over=. ({.,.@;}.)@":@,
  687.        by=. ' '&;@,.@[,.]
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.                                    -13-
  701.  
  702.  
  703.  
  704.  
  705.  
  706.        x by y over x f"0 1 y
  707.     ┌────┬────────────────────────────────────────────────┐
  708.     │    │_9 _1.5 _1 _0.5 0 0.001 0.3 0.4 0.999 1 2 10 100│
  709.     ├────┼────────────────────────────────────────────────┤
  710.     │   9│ 1    1  1    1 1     0   0   0     0 1 1  1   1│
  711.     │ 0.5│ 1    1  1    1 1     0   0   0     0 1 1  1   1│
  712.     │   0│ 1    1  1    1 1     0   0   0     0 1 1  1   1│
  713.     │_0.5│ 1    1  1    1 1     0   0   0     0 1 1  1   1│
  714.     │  _9│ 1    1  1    1 1     0   0   0     0 1 1  1   1│
  715.     └────┴────────────────────────────────────────────────┘
  716.  
  717.     The rank conjunction (") here instructs f to use rank-0 cells
  718.     (atoms, units, or scalars) from the left argument with rank-1 cells
  719.     (lists, longs, or vectors) of the right argument.
  720.  
  721.     We can return to the definition of clean with added understanding.
  722.     It is helpful to use spaces in order to draw attention to the three
  723.     verbs of the fork, but spaces are not required:%%%
  724.          clean=. ] * (<:|)
  725.  
  726.          clean
  727.     ┌─┬─┬──────┐
  728.     │]│*│┌──┬─┐│
  729.     │ │ ││<:│|││
  730.     │ │ │└──┴─┘│
  731.     └─┴─┴──────┘
  732.  
  733.  
  734.     The Number Line:
  735.  
  736.     Negative numbers once seemed absurd or fictitious [23, p.252], but
  737.     a number line makes it easy for a child to grasp a concept that
  738.     once taxed the greatest mathematicians.   In a few years of
  739.     instruction we are each led through the stages that took our
  740.     ancestors generations to achieve.   Experiments should help:
  741.  
  742.           show i=. wholes 10
  743.     0 1 2 3 4 5 6 7 8 9
  744.           10 plus i
  745.     10 11 12 13 14 15 16 17 18 19
  746.  
  747.     Number lines are produced by the following fork:
  748.           nl=. wholes minus floor atop halve
  749.  
  750.  
  751.  
  752.  
  753.  
  754.                                    -14-
  755.  
  756.  
  757.  
  758.  
  759.  
  760.           nl
  761.     ┌──────┬─────┬───────────────┐
  762.     │wholes│minus│┌─────┬─┬─────┐│
  763.     │      │     ││floor│@│halve││
  764.     │      │     │└─────┴─┴─────┘│
  765.     └──────┴─────┴───────────────┘
  766.  
  767.     Or, more concisely in J symbols:
  768.           nl=. i. - <.@-:
  769.     ┌──┬─┬─────────┐
  770.     │i.│-│┌──┬─┬──┐│
  771.     │  │ ││<.│@│-:││
  772.     │  │ │└──┴─┴──┘│
  773.     └──┴─┴─────────┘
  774.           nl 11
  775.     _5 _4 _3 _2 _1 0 1 2 3 4 5
  776.  
  777.     Various number lines can be produced simultaneously by using the
  778.     rank conjunction (") to specify that rank-0 cells (atoms, units, or
  779.     scalars) on the left are to be combined with rank-1 cells (lists,
  780.     longs, or vectors) on the right:
  781.  
  782.           1 10 100 1000 times"0 1 nl 11
  783.        _5    _4    _3    _2    _1 0    1    2    3    4    5
  784.       _50   _40   _30   _20   _10 0   10   20   30   40   50
  785.      _500  _400  _300  _200  _100 0  100  200  300  400  500
  786.     _5000 _4000 _3000 _2000 _1000 0 1000 2000 3000 4000 5000
  787.  
  788.     The argument for nl should be odd.  To ensure that an even argument
  789.     is made odd, define odd as a monadic hook:
  790.     %%%
  791.        odd=. plus one_minus@(2&residue)
  792.        odd
  793.     ┌────┬───────────────────────────┐
  794.     │plus│┌─────────┬─┬─────────────┐│
  795.     │    ││one_minus│@│┌─┬─┬───────┐││
  796.     │    ││         │ ││2│&│residue│││
  797.     │    ││         │ │└─┴─┴───────┘││
  798.     │    │└─────────┴─┴─────────────┘│
  799.     └────┴───────────────────────────┘
  800.     %%%
  801.        odd=. + -.@(2&|)
  802.        odd
  803.  
  804.  
  805.  
  806.  
  807.  
  808.                                    -15-
  809.  
  810.  
  811.  
  812.  
  813.     ┌─┬──────────────┐
  814.     │+│┌──┬─┬───────┐│
  815.     │ ││-.│@│┌─┬─┬─┐││
  816.     │ ││  │ ││2│&│|│││
  817.     │ ││  │ │└─┴─┴─┘││
  818.     │ │└──┴─┴───────┘│
  819.     └─┴──────────────┘
  820.  
  821.           odd 2 4 6 8 laminate 1 3 5 7
  822.     3 5 7 9
  823.     1 3 5 7
  824.     %%%
  825.     This works by dividing the argument by 2 and subtracting the
  826.     remainder (residue) from 1.   The result is then added to the
  827.     argument.   Because the remainder on division by 2 is either 0 or 1
  828.     (depending on whether the number is even or odd, subtracting it
  829.     from 1 changes a 0 to a 1 and a 1 to a zero.   A list (vector) of
  830.     0s and 1s is called logical (taking 1 as true and 0 as false) or
  831.     boolean (after George Boole, who taught us how much can be done
  832.     with an algebra restricted to these two numbers).   In logic the
  833.     verb not converts true to false and false to true.   Boolean
  834.     algebra is, however, part of algebra, and its 0 and 1 can be
  835.     combined with ordinary numbers by algebraic operations.   Because
  836.     there is no difference between the verbs one_minus and not (other
  837.     than their domain), J uses the same symbol (-.) for both.
  838.     %%%
  839.     Define the verb nline, which applies nl after using odd:
  840.        nline=. nl @ odd
  841.        nline"0 right 12 13
  842.     _6 _5 _4 _3 _2 _1 0 1 2 3 4 5 6
  843.     _6 _5 _4 _3 _2 _1 0 1 2 3 4 5 6
  844.     %%%
  845.     Using the verb nsteps (defined above to determine the number of
  846.     steps) produce the required number of wholes (integers):%%%
  847.           g=. i.@>.@>:@nsteps
  848.           0.5 g _2 5
  849.     0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
  850.           0.5 g _2 5.2
  851.     0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
  852.     %%%
  853.     The arithmetic progression vector is a fork containing a fork that
  854.     in turn contains a hook.   The outside fork is:  the first item of
  855.     the right argument ({.@]) plus the fork [*g, which in turn is the
  856.     left argument times the dyadic application of g.%%%
  857.  
  858.  
  859.  
  860.  
  861.  
  862.                                    -16-
  863.  
  864.  
  865.  
  866.  
  867.           apv=. {.@] + [*g
  868.  
  869.           apv
  870.     ┌────────┬─┬───────┐
  871.     │┌──┬─┬─┐│+│┌─┬─┬─┐│
  872.     ││{.│@│]││ ││[│*│g││
  873.     │└──┴─┴─┘│ │└─┴─┴─┘│
  874.     └────────┴─┴───────┘
  875.           0.5 apv _2 5
  876.     _2 _1.5 _1 _0.5 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
  877.     %%%
  878.     Using J primitives (or fixing apv with fix):
  879.     %%%
  880.        apv=. {.@] + [ * i.@>.@>:@(%~ |@-/)
  881.  
  882.  
  883.     Place value:
  884.  
  885.     In learning arithmetic one of the first tasks is to understand
  886.     place notation;  i.e. the values assigned to digits at each
  887.     successive place in a number.   With this in mind we explore as
  888.     follows:
  889.        times insert scan 10 10 10 10 10 10
  890.     10 100 1000 10000 100000 1000000
  891.  
  892.     Because successive multiplications are produced by power:
  893.        10 power 1 2 3 4 5 6
  894.     10 100 1000 10000 100000 1000000
  895.  
  896.     Looking at this result a pupil might wonder what the result of 10
  897.     power 0 would be:
  898.        10 power 0 1 2 3 4 5 6
  899.     1 10 100 1000 10000 100000 1000000
  900.  
  901.     which leads in turn to the exploration of negative values:
  902.        10 power _4 _3 _2 _1 0 1 2 3 4 5 6
  903.     0.0001 0.001 0.01 0.1 1 10 100 1000 10000 100000 1000000
  904.  
  905.     The reciprocals are place values:
  906.           reciprocal 10 power _4 _3 _2 _1 0 1 2 3 4 5 6
  907.     10000 1000 100 10 1 0.1 0.01 0.001 0.0001 1e_5 1e_6
  908.  
  909.     The value assigned to a place is given by the verb place:
  910.        place=.10 with power
  911.  
  912.  
  913.  
  914.  
  915.  
  916.                                    -17-
  917.  
  918.  
  919.  
  920.  
  921.        place 3
  922.     1000
  923.  
  924.     Because we write numbers so that the larger place values are to the
  925.     left (ancient Egyptians usually did the opposite), the values of
  926.     successive places are:
  927.  
  928.        reverse place wholes 7
  929.     1000000 100000 10000 1000 100 10 1
  930.  
  931.     Continuing the series to the right:
  932.           |. 10^ 1 apv _4 4
  933.     10000 1000 100 10 1 0.1 0.01 0.001 0.0001
  934.  
  935.  
  936.     Rounding:
  937.  
  938.     Having grasped place notation, pupils are ready for rounding.
  939.     This must be done mentally, but at an appropriate stage the formal
  940.     process should be introduced.   Because J is an executable
  941.     mathematical notation, its use has the advantage that computing
  942.     skills are taught at the same time.
  943.  
  944.        100 *<.0.5+438%100       NB.   Round 438 to the nearest 100
  945.     400
  946.  
  947.        10 *<.0.5+26%10          NB.   Round 26 to the nearest 10
  948.     30
  949.  
  950.        0.1 *<.0.5+12.345%0.1    NB.   Round 12.345 to the nearest 0.1
  951.     12.3
  952.  
  953.        0.2 *<.0.5+12.345%0.2    NB.   Round 12.345 to the nearest 0.2
  954.     12.4
  955.  
  956.     Rounding will, in general, be to an integer multiple of a given
  957.     number.   This is defined formally as:
  958.           round=. '' : 'x. * <. 0.5+ y.%x.'
  959.  
  960.     where x. and y. are place-holders for the left and right arguments
  961.     respectively.   The empty string preceding the conjunction (:)
  962.     means that we are defining the dyadic case only.   Because the
  963.     arguments are referred to explicitly, this is an example of
  964.     explicit definition, as opposed to the tacit definitions used
  965.     exclusively above.   It can be translated to tacit form by the
  966.     adverb :11  [24]:
  967.  
  968.  
  969.  
  970.                                    -18-
  971.  
  972.  
  973.  
  974.  
  975.  
  976.           'x. * <. 0.5+ y.%x.' : 11
  977.     ┌─┬─┬────────────────────────────┐
  978.     │[│*│┌──┬─┬─────────────────────┐│
  979.     │ │ ││<.│@│┌─────────┬─┬───────┐││
  980.     │ │ ││  │ ││┌───┬─┬─┐│@│┌─┬─┬─┐│││
  981.     │ │ ││  │ │││0.5│&│+││ ││]│%│[││││
  982.     │ │ ││  │ ││└───┴─┴─┘│ │└─┴─┴─┘│││
  983.     │ │ ││  │ │└─────────┴─┴───────┘││
  984.     │ │ │└──┴─┴─────────────────────┘│
  985.     └─┴─┴────────────────────────────┘
  986.  
  987.     This is a fork with * as the central verb.   Because the fork ]%[
  988.     can be written %~  we have:
  989.        round=. [ * <.@(0.5&+@(%~))
  990.  
  991.        round
  992.     ┌─┬─┬──────────────────────────┐
  993.     │[│*│┌──┬─┬───────────────────┐│
  994.     │ │ ││<.│@│┌─────────┬─┬─────┐││
  995.     │ │ ││  │ ││┌───┬─┬─┐│@│┌─┬─┐│││
  996.     │ │ ││  │ │││0.5│&│+││ ││%│~││││
  997.     │ │ ││  │ ││└───┴─┴─┘│ │└─┴─┘│││
  998.     │ │ ││  │ │└─────────┴─┴─────┘││
  999.     │ │ │└──┴─┴───────────────────┘│
  1000.     └─┴─┴──────────────────────────┘
  1001.  
  1002.        10 100 1000 round 146464
  1003.     146460 146500 146000
  1004.  
  1005.        y=. 2 4 6 8
  1006.        show x=. y round 146463
  1007.     146464 146464 146466 146464
  1008.  
  1009.     Verify that these results are indeed (integer) multiples of y
  1010.        x%y
  1011.     73232 36616 24411 18308
  1012.  
  1013.        y=.3 7 11 15 25 33 125
  1014.        show x=. y round 146464
  1015.     146463 146461 146465 146460 146475 146454 146500
  1016.        x%y
  1017.     48821 20923 13315 9764 5859 4438 1172
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.                                    -19-
  1025.  
  1026.  
  1027.  
  1028.  
  1029.     Rounding 438 to the nearest 100
  1030.        (10^2) * <.0.5+438%10^2
  1031.     400
  1032.  
  1033.     Round to given number of decimal places
  1034.        rdp=. '' : '(10^x.) %~ <. 0.5 + y. * 10^x.'
  1035.        0 1 2 3 4 5 rdp o.1
  1036.     3 3.1 3.14 3.142 3.1416 3.14159
  1037.  
  1038.     Rewriting in tacit form:
  1039.        rdp=. 10&^@[ %~ <.@(0.5&+@(] * 10&^@[))
  1040.     This contains two forks, but the last one (] * 10&^@[) can be
  1041.     written as a hook ((* 10&^)~), though this necessitates additional
  1042.     parentheses.
  1043.        rdp=. 10&^@[ %~ <.@(0.5&+@((* 10&^)~))
  1044.        0 1 2 3 4 5 rdp o.1
  1045.     3 3.1 3.14 3.142 3.1416 3.14159
  1046.  
  1047.        rdp
  1048.     ┌──────────────┬─────┬─────────────────────────────────────┐
  1049.     │┌────────┬─┬─┐│┌─┬─┐│┌──┬─┬──────────────────────────────┐│
  1050.     ││┌──┬─┬─┐│@│[│││%│~│││<.│@│┌─────────┬─┬────────────────┐││
  1051.     │││10│&│^││ │ ││└─┴─┘││  │ ││┌───┬─┬─┐│@│┌────────────┬─┐│││
  1052.     ││└──┴─┴─┘│ │ ││     ││  │ │││0.5│&│+││ ││┌─┬────────┐│~││││
  1053.     │└────────┴─┴─┘│     ││  │ ││└───┴─┴─┘│ │││*│┌──┬─┬─┐││ ││││
  1054.     │              │     ││  │ ││         │ │││ ││10│&│^│││ ││││
  1055.     │              │     ││  │ ││         │ │││ │└──┴─┴─┘││ ││││
  1056.     │              │     ││  │ ││         │ ││└─┴────────┘│ ││││
  1057.     │              │     ││  │ ││         │ │└────────────┴─┘│││
  1058.     │              │     ││  │ │└─────────┴─┴────────────────┘││
  1059.     │              │     │└──┴─┴──────────────────────────────┘│
  1060.     └──────────────┴─────┴─────────────────────────────────────┘
  1061.  
  1062.     Rounding to a given number of decimal places is, of course, only a
  1063.     special case of round:
  1064.           (10^-i.6) round o.1
  1065.     3 3.1 3.14 3.142 3.1416 3.14159
  1066.  
  1067.     The hook is obvious in the following:
  1068.        h=. (]*<.@(0.5&+@%)) 10&^
  1069.        rnd=. h~
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.                                    -20-
  1079.  
  1080.  
  1081.  
  1082.  
  1083.        0 _1 _2 _3 _4 _5 rnd o.1
  1084.     3 3.1 3.14 3.142 3.1416 3.14159
  1085.  
  1086.        x=. i.6
  1087.        y=. 146464 14646 1464 146
  1088.        table=. (10^x) round"0 1 y
  1089.     %%%
  1090.     Notice that we simultaneously round many numbers to several
  1091.     different places and produce a table of rounded values.
  1092.     (Iverson's utility verbs by and over are explained in the
  1093.     Appendix)%%%
  1094.  
  1095.        y by x over transpose table
  1096.     ┌──────┬─────────────────────────────────────────┐
  1097.     │      │     0      1      2      3      4      5│
  1098.     ├──────┼─────────────────────────────────────────┤
  1099.     │146464│146464 146460 146500 146000 150000 100000│
  1100.     │ 14646│ 14646  14650  14600  15000  10000      0│
  1101.     │  1464│  1464   1460   1500   1000      0      0│
  1102.     │   146│   146    150    100      0      0      0│
  1103.     └──────┴─────────────────────────────────────────┘
  1104.  
  1105.        table match x rnd "0 1 y
  1106.     1
  1107.  
  1108.     Letting f be the fork and h the hook:
  1109.        f=. ] * <.@(0.5&+@%)
  1110.        h=. (f 10&^)~
  1111.        table -: x h"0 1 y
  1112.     1
  1113.  
  1114.  
  1115.     Examples of rounding exercises from a school workbook [25, p.14,
  1116.     15, 22]:
  1117.  
  1118.        n,: 10 round n=.12 26 165 14 38 43 56 65 97 145 235
  1119.     12 26 165 14 38 43 56 65  97 145 235
  1120.     10 30 170 10 40 40 60 70 100 150 240
  1121.  
  1122.     n,: 100 round n=.170 438 650 160 250 463 729 607 896 717 91 332 548
  1123.     170 438 650 160 250 463 729 607 896 717  91 332 548
  1124.     200 400 700 200 300 500 700 600 900 700 100 300 500
  1125.  
  1126.        10 100 1000 round 8478
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.                                    -21-
  1133.  
  1134.  
  1135.  
  1136.  
  1137.     8480 8500 8000
  1138.  
  1139.     Round the numbers n to the place values given by p:
  1140.        n=. 8217 4096 7358 6105 8654 5583 7950 6008
  1141.        p=. 10 100 1000
  1142.        table=.|: p round"0 1 n
  1143.  
  1144.        n by p over table
  1145.     ┌────┬──────────────┐
  1146.     │    │  10  100 1000│
  1147.     ├────┼──────────────┤
  1148.     │8217│8220 8200 8000│
  1149.     │4096│4100 4100 4000│
  1150.     │7358│7360 7400 7000│
  1151.     │6105│6110 6100 6000│
  1152.     │8654│8650 8700 9000│
  1153.     │5583│5580 5600 6000│
  1154.     │7950│7950 8000 8000│
  1155.     │6008│6010 6000 6000│
  1156.     └────┴──────────────┘
  1157.  
  1158.  
  1159.     Concluding Remarks:
  1160.  
  1161.     This paper illustrates some aspects of the J dialect of APL using
  1162.     examples related to the teaching of elementary arithmetic.    It
  1163.     demonstrates that hooks and forks are ubiquitous, and shows how to
  1164.     use them in reading and writing J.   Examples are given of
  1165.     displays that show how expressions are parsed.   These are
  1166.     invaluable aids in understanding the language.
  1167.  
  1168.     Definitions are given in tacit form.   They are functional as
  1169.     advocated by Backus [26].
  1170.  
  1171.     Because J is evolving, it is essential to note which version is
  1172.     used.  Examples are included of changes that were made between
  1173.     versions. The files Status.Doc and Xenos.Doc, provided with the
  1174.     system, document changes from earlier versions.   All examples
  1175.     included in this paper have been executed with Version 3.5x4.
  1176.  
  1177.     As from Version 3.5x1, 1991 8 26, the two remaining "system
  1178.     commands" have been replaced by verbs created by the external
  1179.     conjunction (!:).
  1180.          )script       replaced by 0!:2
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.                                    -22-
  1187.  
  1188.  
  1189.  
  1190.  
  1191.          )sscript      replaced by 0!:3
  1192.          )off          replaced by 0!:55
  1193.     It is convenient to include the following verbs in the file
  1194.     profile.js, which is loaded automatically at the start of a
  1195.     session.
  1196.          script=. 0!:2@< : (<@[ 0!:2 <@])
  1197.          off=. 0!:55
  1198.  
  1199.     script is an ambi-valent verb that permits specification of output
  1200.     and input script files;  e.g.   'output.fil' script 'input.fil'
  1201.  
  1202.     Because off is a verb, it must have an argument.   To terminate a
  1203.     session and return to DOS, enter off 0
  1204.  
  1205.     Remembering Klein's Elementary Mathematics from an Advanced
  1206.     Standpoint [27], in this paper I have treated topics in elementary
  1207.     arithmetic from a relatively advanced viewpoint.   I hope teachers
  1208.     will find stimulation for themselves and be able to select examples
  1209.     suitable for pupils at various levels.   Even very young children
  1210.     can use some of the examples, if only to check their answers.   The
  1211.     exercise could provide an excellent introduction to both computing
  1212.     and mathematics.   The literature of J is still limited.   This
  1213.     paper may be useful as an introduction for anyone wishing to try J.
  1214.  
  1215.  
  1216.     Acknowledgements:
  1217.     %%%
  1218.     Kenneth Iverson, Roger Hui, and Eugene McDonnell (Iverson Software
  1219.     Inc.) generously provided invaluable support on numerous occasions.
  1220.     Mrs. Rosemary Roache and Julian Romanes (Edradour School) gave
  1221.     insight into the teaching of elementary mathematics.   Anthony
  1222.     Camacho and Graham Woyka encouraged me to write about learning J.
  1223.     Anthony Camacho's suggestions improved the paper.
  1224.     %%%
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.                                    -23-
  1241.  
  1242.  
  1243.  
  1244.  
  1245.     Appendix: Displaying a table with over and by:
  1246.  
  1247.     Iverson has provided the utility verbs over and by [5, p.7; 28,
  1248.     p.272].   Users new to J will find them well worthy of study in
  1249.     their own right.   The following discussion may be helpful.
  1250.  
  1251.        over=. ({.,.@;}.)@":@,
  1252.        by=. ' '&;@,.@[,.]
  1253.  
  1254.     Notice that over contains the fork  {. ,.@; }. and by is built upon
  1255.     the fork  ' '&;@,.@[) ,. ]
  1256.  
  1257.     While reference [8] was in press, the symbols for Ravel Items and
  1258.     Raze were interchanged (Version 3.2, June 1991).   Because the
  1259.     monadic form Ravel Items changed from ";" in J3 to the form ",."
  1260.     (as in J3.5x4, 1991 10 22), the versions of over and by given in
  1261.     [8] must now be written as follows:
  1262.           over=. ,. @ ({. ; }.) @ ": @ ,
  1263.           by=. (,~"_1 ' '&; @ ,.)~
  1264.  
  1265.     In these versions, over contains the fork  {. ; }. and by is built
  1266.     on the hook  (,~"_1) (' '&;@,.)
  1267.     J's displays are invaluable aids in learning to read and write
  1268.     verbs like these.   Compare two versions of by each in two types of
  1269.     display:
  1270.  
  1271.           by=. ' '&;@,.@[,.]
  1272.           by
  1273.     ┌────────────────────┬──┬─┐
  1274.     │┌──────────────┬─┬─┐│,.│]│
  1275.     ││┌───────┬─┬──┐│@│[││  │ │
  1276.     │││┌─┬─┬─┐│@│,.││ │ ││  │ │
  1277.     ││││ │&│;││ │  ││ │ ││  │ │
  1278.     │││└─┴─┴─┘│ │  ││ │ ││  │ │
  1279.     ││└───────┴─┴──┘│ │ ││  │ │
  1280.     │└──────────────┴─┴─┘│  │ │
  1281.     └────────────────────┴──┴─┘
  1282.  
  1283.           tree 'by'
  1284.                              ┌─
  1285.                        ┌─ & ─┴─ ;
  1286.                  ┌─ @ ─┴─ ,.
  1287.            ┌─ @ ─┴─ [
  1288.     ─ by ──┼─ ,.
  1289.            └─ ]
  1290.  
  1291.  
  1292.  
  1293.  
  1294.                                    -24-
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.           by=. (,~"_1 ' '&; @ ,.)~
  1302.           by
  1303.     ┌─────────────────────────────┬─┐
  1304.     │┌────────────┬──────────────┐│~│
  1305.     ││┌─────┬─┬──┐│┌───────┬─┬──┐││ │
  1306.     │││┌─┬─┐│"│_1│││┌─┬─┬─┐│@│,.│││ │
  1307.     ││││,│~││ │  ││││ │&│;││ │  │││ │
  1308.     │││└─┴─┘│ │  │││└─┴─┴─┘│ │  │││ │
  1309.     ││└─────┴─┴──┘│└───────┴─┴──┘││ │
  1310.     │└────────────┴──────────────┘│ │
  1311.     └─────────────────────────────┴─┘
  1312.  
  1313.           tree 'by'
  1314.                        ┌─ ~ ─── ,
  1315.                  ┌─ " ─┴─ _1
  1316.                  │           ┌─
  1317.     ─ by ── ~ ───┤     ┌─ & ─┴─ ;
  1318.                  └─ @ ─┴─ ,.
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.                                    -25-
  1349.  
  1350.  
  1351.  
  1352.  
  1353.     References
  1354.  
  1355.         [1]  Donald B. McIntyre, Introduction to the Study of Data
  1356.              Matrices, In: Models of Geologic Processes:  an
  1357.              Introduction to Mathematical Geology.  Short Course
  1358.              Lecture Notes, Philadelphia, November 1969. Edited by
  1359.              Peter Fenner.   American Geological Institute, Washington
  1360.              D.C. (1969) p.A1-A44, B1-B17, C1-C4.
  1361.  
  1362.         [2]    Donald B. McIntyre, The Architectural Elegance of Crystals
  1363.              made clear by APL, In:  Conference Proceedings, APL Users
  1364.              Meeting, Toronto, September 1978.   Sponsored by I.P.
  1365.              Sharp Associates, Toronto (1978) p.233-250.
  1366.  
  1367.         [3]    Donald B. McIntyre, APL in a Liberal Arts College, In:
  1368.              Conference Proceedings, APL Users Meeting, Toronto,
  1369.              October 1980.  Sponsored by I.P. Sharp Associates, Toronto
  1370.              (1980), p.544-574.
  1371.  
  1372.         [4]    Kenneth E. Iverson, ISI Dictionary of J, Version 3.3 with
  1373.              Tutorials, Iverson Software inc., Toronto (1991) 32pp.
  1374.  
  1375.         [5]    Kenneth E. Iverson, Programming in J, Iverson Software
  1376.              inc., Toronto (1991) 71pp.
  1377.  
  1378.         [6]    Kenneth E. Iverson, Tangible Math, Iverson Software inc.,
  1379.              Toronto (1991) 33pp.
  1380.  
  1381.         [7]    Kenneth E. Iverson, A Personal View of APL, IBM Systems
  1382.              Journal, Vol. 30, Number 4 (1991) In Press.
  1383.  
  1384.         [8]    Donald B. McIntyre, Mastering J, APL91 Conference
  1385.              Proceedings, Stanford, California, August 1991.   APL
  1386.              Quote Quad Vol. 21 Number 4 (August 1991), p.264-273.
  1387.  
  1388.         [9]    Zdenek V. Jizba, Science Education in California, Vector
  1389.              vol.8 number 2 (1991) p.22-24.
  1390.  
  1391.         [10] Florian Cajori, A History of Mathematical Notations,  The
  1392.              Open Court Publishing Company, La Salle, Illinois. Volume
  1393.              1 (1951) 451pp. First published 1928;  Volume 2 (1952)
  1394.              367pp.  First published 1929.
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402.                                    -26-
  1403.  
  1404.  
  1405.  
  1406.  
  1407.         [11]    Tobias Dantzig, Number: the Language of Science, London,
  1408.              George Allen and Unwin, Ltd.   2nd edition (1942) 320pp.
  1409.              First Published 1936, 4th edition 1962.
  1410.  
  1411.         [12]    Donald B. McIntyre, Language as an Intellectual Tool:
  1412.              From hieroglyphics to APL, IBM Systems Journal, Vol. 30,
  1413.              Number 4 (1991) In Press.
  1414.  
  1415.         [13]    Lancelot Hogben, Mathematics for the Million, London,
  1416.              George Allen and Unwin, Ltd (1936) 678pp.
  1417.  
  1418.         [14]    Kenneth E. Iverson, Notation as a Tool of Thought, 1979
  1419.              Turing Award Paper, Communications of the A.C.M., Vol.23,
  1420.              Number 8 (August, 1980) p.444-465
  1421.  
  1422.         [15]    Roger K.W. Hui, Kenneth E. Iverson, E.E. McDonnell, and
  1423.              Arthur T. Whitney, APL\?, APL90 Conference Proceedings,
  1424.              Copenhagen, Denmark, August 1990.  APL Quote Quad Vol. 20,
  1425.              Number 4 (July 1990) p.192-200.
  1426.  
  1427.         [16]    Robert Bernecky and Roger K.W. Hui, Gerunds and
  1428.              Representations, APL91 Conference Proceedings, Stanford,
  1429.              California, August 1991.  APL Quote Quad Vol. 21, Number 4
  1430.              (August 1991) p.39-46.
  1431.  
  1432.         [17]    Kenneth E. Iverson, and E.E. McDonnell, Phrasal Forms,
  1433.              APL89 Conference Proceedings, New York City, August 1989.
  1434.              QuoteQuad, Volume 19, Number 4, (1989) p.197-199.
  1435.  
  1436.         [18]    J is available from Iverson Software Inc., 33 Major
  1437.              Street, Toronto, Ontario, Canada M5S  2K9.   Phone (416)
  1438.              925-6096; Fax (416) 488-7559.
  1439.  
  1440.         [19]    Kenneth E. Iverson, A Programming Language, John Wiley and
  1441.              Sons, Inc., New York (1962) 286pp.
  1442.  
  1443.         [20]    Kenneth E. Iverson, Elementary Analysis, APL Press,
  1444.              Swarthmore, Pennsylvania (1976) 219pp.
  1445.  
  1446.         [21]    Donald B. McIntyre, Experience with Direct Definition One-
  1447.              liners in Writing APL Applications, Conference
  1448.              Proceedings, APL Users Meeting, Toronto, September 1978.
  1449.              Sponsored by I.P. Sharp Associates, Toronto (1978) p.281-
  1450.              297.
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.                                    -27-
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462.         [22] William K. Clifford, The Common Sense of the Exact
  1463.              Sciences, Edited with a preface by KArl Pearson.  Newly
  1464.              edited and with an introduction by James R. Newman.
  1465.              Preface by Bertrand Russell.  With bibliography of W.K.
  1466.              Clifford.   Alfred A. Knopf, New York (1946), Sigma Books,
  1467.              Ltd., London (1947) 249pp..   Reprinted by Dover
  1468.              Publications, Inc., New York (1955).   Chapter 1, Number,
  1469.              Section 11, Steps.
  1470.  
  1471.         [23] Morris Kline, Mathematical Thought from Ancient to Modern
  1472.              Times, Oxford University Press, New York (1972) 1238pp.
  1473.  
  1474.         [24]    Roger K.W. Hui, Kenneth E. Iverson, Eugene E. McDonnell,
  1475.              Tacit Definition, APL91 Conference Proceedings, Stanford,
  1476.              California, August 1991.   APL Quote Quad Vol. 21 Number 4
  1477.              (August 1991), p.264-273.
  1478.  
  1479.         [25]    Roy Hollands, Ginn Mathematics Level 4, Teachers' Resource
  1480.              Book, Ginn and Company Ltd, Aylesbury, Bucks. (1983),
  1481.              Third impression 1985, 160pp.   Intended for 8 to 9 year
  1482.              old children.
  1483.  
  1484.         [26] John Backus, Can programming be liberated from the Von
  1485.              Neumann style?   A functional style and its algebra of
  1486.              programs.   1977 Turing Award Lecture.  Communications of
  1487.              the ACM, Vol. 21, number 8 (1978) p.613-641.
  1488.  
  1489.         [27]    Felix Klein, Elementary Mathematics from an Advanced
  1490.              Standpoint, Third Edition first published 1924-1925.
  1491.              English translation published by Dover Publications Inc.,
  1492.              New York. 2 Volumes, (1939) 274pp. and 214pp.
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.                                    -28-
  1511.  
  1512.  
  1513.